/**
 * \file basis_test.hpp
 * 
 * \section COPYRIGHT
 *
 * Basis: A 3D Mathematics Library
 *
 * ---------------------------------------------------------------------
 *
 * Copyright (c) 2010, Don Olmstead
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  1. Redistributions of source code must retain the above copyright notice,
 *     this list of conditions and the following disclaimer.
 *
 *  2. Redistributions in binary form must reproduce the above copyright notice,
 *     this list of conditions and the following disclaimer in the documentation
 *     and/or other materials provided with the distribution.
 *
 *  3. Neither the name of organization nor the names of its contributors may be
 *     used to endorse or promote products derived from this software without
 *     specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef BASIS_TEST_HPP_INCLUDED
#define BASIS_TEST_HPP_INCLUDED

// Include the unit testing framework
#include <UnitTest/UnitTest++.h>

// Include the mathematics classes
#include <basis/scalar.hpp>
#include <basis/vector2.hpp>
#include <basis/vector3.hpp>
#include <basis/vector4.hpp>

// Include the SIMD interfaces
#include <basis/detail/packed_type.hpp>
#include <basis/detail/sse_type.hpp>

//------------------------------------------------------------
// Configuration options
//------------------------------------------------------------

// Set the real number type to use
typedef float real_type;

// Set the SIMD type to use
typedef basis::detail::packed_type<real_type> simd_type;
//typedef basis::detail::sse_type<float> simd_type;

//typedef basis::detail::sse_type<real_type> simd_type;

//------------------------------------------------------------
// Check macros
//------------------------------------------------------------

/**
 * Checks whether an array is equal to a vector2.
 *
 * \param expected The expected result.
 * \param actual The actual result.
 * \param tolerance The tolerance for two real numbers being equal.
 */
#define CHECK_VECTOR2_CLOSE(expected, actual, tolerance) \
	CHECK_CLOSE(expected[0], actual.x(), tolerance); \
	CHECK_CLOSE(expected[1], actual.y(), tolerance); 

/**
 * Checks whether an array is equal to a vector3.
 *
 * \param expected The expected result.
 * \param actual The actual result.
 * \param tolerance The tolerance for two real numbers being equal.
 */
#define CHECK_VECTOR3_CLOSE(expected, actual, tolerance) \
	CHECK_CLOSE(expected[0], actual.x(), tolerance); \
	CHECK_CLOSE(expected[1], actual.y(), tolerance); \
	CHECK_CLOSE(expected[2], actual.z(), tolerance); 

/**
 * Checks whether an array is equal to a vector4.
 *
 * \param expected The expected result.
 * \param actual The actual result.
 * \param tolerance The tolerance for two real numbers being equal.
 */
#define CHECK_VECTOR4_CLOSE(expected, actual, tolerance) \
	CHECK_CLOSE(expected[0], actual.x(), tolerance); \
	CHECK_CLOSE(expected[1], actual.y(), tolerance); \
	CHECK_CLOSE(expected[2], actual.z(), tolerance); \
	CHECK_CLOSE(expected[3], actual.w(), tolerance);

#endif // end BASIS_TEST_HPP_INCLUDED
